<!DOCTYPE HTML>
<html>
	<head>
	<title>打板</title>
	<link href="css/text.css" rel="stylesheet" type="text/css" />
	<meta charset="utf-8" />
	<style>
		.fixedBox{
				border: 1px solid #555555;				
				white-space: nowrap;	
			}
			.fixedBox::-webkit-scrollbar {
				width: 12px;     
				height: 12px;				
			}			
		table{
			width:500px; 
			border-collapse:collapse; 
			text-align:center;
		}
		td,th{border:1px solid #696969}
	</style>
	<script type="text/javascript" src="js/jquery.min.js"></script>
	<script type="text/javascript" src="DatePicker/WdatePicker.js"> </script>
	</head>
	<body>
		<div id="towrite" class="fixedBox"></div>
		<div id="data"></div>		
		<script>
			var bkcolor = $("body").css("backgroundColor");
			var dt = "";
			var tt = "";			
			var k = 0;		
			window.onload = function() {
				var day = new Date();				
				mymonth = day.getMonth()+1;
				myday = day.getDate();
				if(mymonth >= 10){mymonth = mymonth;}else{mymonth = "0" + mymonth;}
				if(myday >= 10){myday = myday;}else{myday = "0" + myday;}
				tt = day.getFullYear() + "-" + mymonth + "-" + myday;
				dt = tt;			
				changeStyle();
				getSource(1);
			}
						
			function time_range(beginTime, endTime) {
				var strb = beginTime.split(":");
				if (strb.length != 2) {
					return false;
				}

				var stre = endTime.split(":");
				if (stre.length != 2) {
					return false;
				}

				var b = new Date();
				var e = new Date();
				var n = new Date();

				b.setHours(strb[0]);
				b.setMinutes(strb[1]);
				e.setHours(stre[0]);
				e.setMinutes(stre[1]);

				if (n.getTime() - b.getTime() > 0 && n.getTime() - e.getTime() < 0) {					
					getSource(fs);					
					console.log(true)　　　　　　
					return true;				
				} else {
					console.log(false)
				    return false;     
				}
			}　　　
   　　　
			$(function() {
				setInterval(function() {
				time_range("9:00","15:15")						
				},
				60000);
			})
			
			function changeStyle() {
				var obj = document.getElementById("towrite");								
				obj.style.left= "0px"; 				
				obj.style.width= "1020px";	
				//obj.style.height= "620px";		
				obj.style.fontSize="12px";					
			}
			
			function createXmlHttp() {
				if (window.XMLHttpRequest) {
				xmlHttp = new XMLHttpRequest();
				} else {
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
				}
			}
			
			function keepTwoDecimal(num) {  
               var result = parseFloat(num);  
               if (isNaN(result)) {                    
                   return false;  
               }  
               result = Math.round(num * 100) / 100;  
               return result;  
			};
			
			<!-- var trid = ""; -->
			<!-- function changeCss(obj,hid,id){						 -->
				<!-- var tlist = document.getElementById(id).getElementsByTagName("tr");					 -->
				<!-- for(var i = 0; i < tlist.length; i++){														 -->
					<!-- tlist[i].style.backgroundColor = bkcolor; 					 -->
				<!-- } -->
				<!-- trid = hid; -->
				<!-- var tr = document.getElementById(hid);				 -->
				<!-- tr.style.backgroundColor = "#483D8B";						 -->
			<!-- } -->
			
			<!-- function hover(){  //鼠标经过 -->
				<!-- var rows = document.getElementsByTagName('tr'); -->
				<!-- for(var i=0;i<rows.length;i++){ -->
					<!-- rows[i].onmouseover=function(){						 -->
						<!-- if(this.id != ""){  //过滤表头 -->
							<!-- this.style.background="#800000"; -->
						<!-- } -->
					<!-- } -->
					<!-- rows[i].onmouseout=function(){ -->
						<!-- if(this.id != ""){  //过滤表头 -->
							<!-- if(this.id != trid){  //过滤选中行 -->
								<!-- this.style.background=bkcolor; -->
							<!-- }else{ -->
								<!-- this.style.background="#483D8B"; -->
							<!-- } -->
						<!-- }						 -->
					<!-- }					 -->
				<!-- } -->
			<!-- }			 -->
			
			var trid = "";
			var trs = "";
			function changeCss(obj,id){	
				trs = "";
				var t = obj.parentNode.parentNode.id;  //td父节点tr id
				var ty = t.split("#")[1];
				var ty1 = "";
				var ty2 = "";
				if(ty.indexOf("、") > -1){
					ty1 = ty.split("、")[0];
					ty2 = ty.split("、")[1];
				}
				
				var tlist = document.getElementById(id).getElementsByTagName("tr");					
				for(var i = 0; i < tlist.length; i++){
					if(tlist[i].id != ""){
						var dm = tlist[i].id.split("#")[0];
						var yy = tlist[i].id.split("#")[1];
						if(t == tlist[i].id){
							tlist[i].style.backgroundColor = "#483D8B";  //选中行
							trid = t;
						}else if(ty.indexOf("、") > -1){
							if(yy.indexOf(ty1) > -1 || yy.indexOf(ty2) > -1){
								tlist[i].style.backgroundColor = "#800080"; //相同涨停原因
								trs += tlist[i].id;
							}else{
								tlist[i].style.backgroundColor = bkcolor; 				
							}	
						}else{
							if(yy.indexOf(ty) > -1){
								tlist[i].style.backgroundColor = "#800080"; //相同涨停原因
								trs += tlist[i].id;
							}else{
								tlist[i].style.backgroundColor = bkcolor; 				
							}	
						}	
					}					
				}				
			}
			
			function hover(){  //鼠标经过
				var rows = document.getElementsByTagName('tr');
				for(var i=0;i<rows.length;i++){
					rows[i].onmouseover=function(){							
						if(this.id != ""){  //过滤表头
							this.style.background="#800000";
						}
					}
					rows[i].onmouseout=function(){						
						if(this.id != ""){  //过滤表头
							if(this.id == trid){  //过滤选中行
								this.style.background="#483D8B";
							}else if(trs.indexOf(this.id) > -1){
								this.style.background="#800080";
							}else{
								this.style.background=bkcolor;
							}
						}						
					}					
				}
			}			
			
			function NumberTransform(num) { 
				var result = parseFloat(num);
				if (isNaN(result)) {                    
                   return false;  
               }  				
 				//var result = 110000000;  
               if(Math.abs(result) > 100000000){
			   //alert(1)
				result = result / 100000000;
				result = result.toFixed(2) + "亿";
			   }else if(Math.abs(result) > 10000){
			   // alert(2)
			    result = result/10000;
				result = result.toFixed(2) + "万";
			   }
			    //alert(result)
               return result;  
			};	
			
			Date.prototype.Format = function (fmt) {
				var o = {
				"M+": this.getMonth() + 1, //月份
				"d+": this.getDate(), //日
				"h+": this.getHours(), //小时
				"m+": this.getMinutes(), //分
				"s+": this.getSeconds(), //秒
				"q+": Math.floor((this.getMonth() + 3) / 3), //季度
				"S": this.getMilliseconds() //毫秒
				};
				if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
				for (var k in o)
				if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
				return fmt;
			};
			
			function getLocalTime(nS) {			          
				return new Date(parseInt(nS*1000)).Format("hh:mm:ss")
			}

					
			function cDayFunc(dp) 
			{ 
				var date = dp.cal.getNewDateStr();            
				BookingRmk(date);//调用其它函数并带上参数                
			}
			
			function BookingRmk(date)
			{         
				tt = date;
				var date1 = new Date(tt);
				var date2 = new Date(dt);
				//alert("tt:"+tt+"|"+"dt:"+dt);				
				k = 0;
				if(date1.getTime() < date2.getTime()){			
					k = 1;
					tradeday();
				}								
				getSource(fs);						
			}
			
			function tradeday() {  //判断最后交易日
				var day = new Date(tt);							
				for (i = 1; i < 100; i++){	//节假日																										
					if(i > 1){
						day.setTime(day.getTime() - 24*60*60*1000);							
					}	
					tt = day.Format("yyyy-MM-dd");
					//alert(tt);
					var url = "https://apphis.longhuvip.com/w1/api/index.php?Order=1&a=HisDaBanList&st=10&c=HisHomeDingPan&Is_st=1&PidType=2&apiv=w30&Type=6&Day=" + tt;
					var xhr = new XMLHttpRequest();	
					xhr.open("GET", url, false);//同步 
					xhr.send(null)																										
					var data = xhr.responseText;
					//document.write(data);
					if(data.indexOf('"list":[]') == -1){						
						break;
					}
				}
			}	
			
			var fs = "";			
			function getSource(p) {	
				if(k == "1" && p == 1){
					p = 2;
				}	
				fs = p;				
				div = document.getElementById('towrite');				
				var p1 = "<a href='javascript:void(0)' id='px1' onclick='getSource(" + "1" + ")'>" + "即将涨停" + "</a>";
				if(k == "1" ){
					p1 = "";					
				}
				var p2 = "<a href='javascript:void(0)' id='px2' onclick='getSource(" + "2" + ")'>" + "涨停" + "</a>";	
				var p3 = "<a href='javascript:void(0)' id='px3' onclick='getSource(" + "3" + ")'>" + "炸板" + "</a>";
				var p4 = "<a href='javascript:void(0)' id='px4' onclick='getSource(" + "4" + ")'>" + "自然涨停" + "</a>";				
				div.innerHTML = '<font size="4">班长打板</font><font size="2">（ ' + p1 + p2 + p3 + p4 + '）</font><input style="width: 120px;" type="text" id="PriceDate" name="PriceDate" class="Wdate" onFocus="WdatePicker({ onpicking: cDayFunc})" /><br><br>';						
				
				aObj = document.getElementById('px' + p);				
				aObj.style.color = "#FFA07A";
				var pid = "";
				var type = "";
				if(p == 1){
					pid = "0";
					type = "4";
				}else if(p == 2){
					pid = "1";
					type = "6";
				}else if(p == 3){
					pid = "2";
					type = "4";
				}else if(p == 4){
					pid = "4";
					type = "6";
				}				
				var url1 = "https://apphq.longhuvip.com/w1/api/index.php?Order=1&a=DaBanList&st=1000&apiv=w21&Type=" + type + "&c=HomeDingPan&Is_st=1&PidType=" + pid;
				var url2 = "https://apphis.longhuvip.com/w1/api/index.php?Order=1&a=HisDaBanList&st=1000&c=HisHomeDingPan&Is_st=1&PidType=" + pid + "&apiv=w30&Type=" + type + "&Day=" + tt;
				
				var url = url1;
				if(k == "1" ){
					url = url2;
				}
				
				createXmlHttp();
				xmlHttp.onreadystatechange = writeSource;
				xmlHttp.open("GET", url, true);					
				xmlHttp.send(null);				
			}
			
			var bk = 0;
			var gl = "";  //高亮
			function writeSource() { 
				if (xmlHttp.readyState == 4) {					
					var data = xmlHttp.responseText	
					if(fs == 4 && k == 1){
						//document.write(data);
					}
					
					if(k == 0){
						tt = data.match(/"day":"(\S*)","/)[1];
						dt = tt;
					}

					data = data.replace(/ /g,"").match(/{"list":(\S*)/)[1].split("]]")[0] + "]]";
									
					if(fs == 1){
						gl = "涨幅";
						data = data.replace(/(\[\").*?(?=\])/g,function(word){ 
							str = word.match(/\[(\S*)/)[1];						
							return '{"代码":' + str.split(',')[0] + 
							',"名称":' + str.split(',')[1] + 						
							',"现价":' + str.split(',')[17] +
							',"涨幅%":' + str.split(',')[4] + 					
							',"涨速%":' + str.split(',')[5]+ 
							',"实际换手%":' + str.split(',')[14]+
							',"实际流通":' + str.split(',')[15] +						
							<!-- ',"主力净额":' + str.split(',')[12] +  -->
							<!-- ',"成交额":' + str.split(',')[13] +						 -->
							',"板块":' + str.split(',')[11];						
						});
					}else if(fs == 2){
						gl = "涨停时间";
						data = data.replace(/(\[\").*?(?=\])/g,function(word){ 
							str = word.match(/\[(\S*)/)[1];	
							var xj = ',"现价":' + str.split(',')[17];
							if(k == 1){
								xj = "";
							}
							return '{"代码":' + str.split(',')[0] + 
							',"名称":' + str.split(',')[1] + 						
							xj +
							',"涨停时间":' + str.split(',')[6] + 
							',"最后涨停时间":' + str.split(',')[25] + 
							',"状态":' + str.split(',')[9]+ 
							',"最大封单":' + str.split(',')[23] + 
							',"封单":' + str.split(',')[8] + 
							',"实际换手%":' + str.split(',')[14]+
							',"实际流通":' + str.split(',')[15] +						
							',"主力净额":' + str.split(',')[12] + 
							',"成交额":' + str.split(',')[13] +	
							',"涨停原因":"' + str.split(',')[16].replace(/"/g,"") + "(" + str.split(',')[27]  + ')"' +	
							',"板块":' + str.split(',')[11];						
						});
					}else if(fs == 3){
						gl = "涨幅";
						data = data.replace(/(\[\").*?(?=\])/g,function(word){ 
							str = word.match(/\[(\S*)/)[1];
							var xj = ',"现价":' + str.split(',')[17];
							if(k == 1){
								xj = "";
							}
							return '{"代码":' + str.split(',')[0] + 
							',"名称":' + str.split(',')[1] + 						
							xj +
							',"涨幅%":' + str.split(',')[4] + 
							',"涨停时间":' + str.split(',')[6] + 
							',"开板时间":' + str.split(',')[7] + 													
							',"实际换手%":' + str.split(',')[14]+
							',"实际流通":' + str.split(',')[15] +						
							',"主力净额":' + str.split(',')[12] + 
							',"成交额":' + str.split(',')[13] +								
							',"板块":' + str.split(',')[11];						
						});
					}else if(fs == 4){
						gl = "涨停时间";
						data = data.replace(/(\[\").*?(?=\])/g,function(word){ 
							str = word.match(/\[(\S*)/)[1];											
							var xj = ',"现价":' + str.split(',')[17];
							var esj = ',"最后涨停时间":' + str.split(',')[25];
							var zdfd = ',"最大封单":' + str.split(',')[23];
							if(k == 1){
								xj = "";
								esj = "";
								zdfd = "";
							}
							return '{"代码":' + str.split(',')[0] + 
							',"名称":' + str.split(',')[1] + 						
							xj +
							',"涨停时间":' + str.split(',')[6] + 
							esj + 
							',"状态":' + str.split(',')[9]+ 
							zdfd + 
							',"封单":' + str.split(',')[8] + 
							',"实际换手%":' + str.split(',')[14]+
							',"实际流通":' + str.split(',')[15] +						
							',"主力净额":' + str.split(',')[12] + 
							',"成交额":' + str.split(',')[13] +	
							',"涨停原因":"' + str.split(',')[16].replace(/"/g,"") + "(" + str.split(',')[27]  + ')"' +
							',"板块":' + str.split(',')[11];						
						});
					}
					data = data.replace(/\],\{/g,"},{").replace("]]","}]");
					//document.write(data);
					
					//最后涨停时间				
					data = data.replace(/(\"最后涨停时间\":).*?(?=,)/g, function(word){ 				
						str = word.match(/\"最后涨停时间\":(\S*)/)[1]; 					
						return '\"最后涨停时间\":"' + getLocalTime(str) + '"';
					});  
					
					//涨停时间				
					data = data.replace(/(\"涨停时间\":).*?(?=,)/g, function(word){ 				
						str = word.match(/\"涨停时间\":(\S*)/)[1]; 					
						return '\"涨停时间\":"' + getLocalTime(str) + '"';
					});  	
					
					//开板时间				
					data = data.replace(/(\"开板时间\":).*?(?=,)/g, function(word){ 				
						str = word.match(/\"开板时间\":(\S*)/)[1]; 					
						return '\"开板时间\":"' + getLocalTime(str) + '"';
					});  
					
					//实际流通				
					data = data.replace(/(\"实际流通\":).*?(?=,)/g, function(word){ 						
					str = word.match(/\"实际流通\":(\S*)/)[1]; 					
					if(keepTwoDecimal(Math.abs(str/100000000)) >= 1){
						return '\"实际流通\":\"' + keepTwoDecimal(str/100000000) + '亿\"';
					}else{
						return '\"实际流通\":\"' + Math.round(str/10000) + '万\"';
					}								
					}); 			
					
					//主力净额				
					data = data.replace(/(\"主力净额\":).*?(?=,)/g, function(word){ 						
					str = word.match(/\"主力净额\":(\S*)/)[1]; 					
					if(keepTwoDecimal(Math.abs(str/100000000)) >= 1){
						return '\"主力净额\":\"' + keepTwoDecimal(str/100000000) + '亿\"';
					}else{
						return '\"主力净额\":\"' + Math.round(str/10000) + '万\"';
					}								
					}); 			
					
					//成交额				
					data = data.replace(/(\"成交额\":).*?(?=,)/g, function(word){ 						
					str = word.match(/\"成交额\":(\S*)/)[1]; 					
					if(keepTwoDecimal(Math.abs(str/100000000)) >= 1){
						return '\"成交额\":\"' + keepTwoDecimal(str/100000000) + '亿\"';
					}else{
						return '\"成交额\":\"' + Math.round(str/10000) + '万\"';
					}								
					}); 					
					
					//最大封单				
					data = data.replace(/(\"最大封单\":).*?(?=,)/g, function(word){ 						
					str = word.match(/\"最大封单\":(\S*)/)[1]; 					
					if(keepTwoDecimal(Math.abs(str/100000000)) >= 1){
						return '\"最大封单\":\"' + keepTwoDecimal(str/100000000) + '亿\"';
					}else{
						return '\"最大封单\":\"' + Math.round(str/10000) + '万\"';
					}								
					}); 		
					
					//封单				
					data = data.replace(/(\"封单\":).*?(?=,)/g, function(word){ 						
					str = word.match(/\"封单\":(\S*)/)[1]; 					
					if(keepTwoDecimal(Math.abs(str/100000000)) >= 1){
						return '\"封单\":\"' + keepTwoDecimal(str/100000000) + '亿\"';
					}else{
						return '\"封单\":\"' + Math.round(str/10000) + '万\"';
					}								
					}); 		
					
					var json = JSON.parse(data);
					
					//document.write(json);
					
					//创建table					
					var table=document.createElement("table");										
					var thead=document.createElement("thead");
					table.appendChild(thead);					
					var tr=document.createElement("tr");
					thead.appendChild(tr);					
					
					var m = 0;
					var n = 0;
					var b = 0;					
					for(var key in json[0]){  //表头											
						var th=document.createElement("th");						
						th.innerHTML=key;						
						tr.appendChild(th);
						if(gl == key.replace("%","")){
							n = m;
							th.style.color = "#FF6633";	
						}
						if(key == "板块"){
							b = m;
							bk = b;
							th.style.color = "#FFA500";	
						}
						m++;
					}
										
					var tbody=document.createElement("tbody");					
					table.appendChild(tbody);
					
					//遍历json
					for(var i = 0; i < json.length; i++){					
						var tr=document.createElement("tr");						
						var p = 1;
						var dm = "";
						var mc = "";
						for(var key in json[i]){ //行元素遍历						
							var td=document.createElement("td");							
							
							var rc = json[i][key];
							if(p == 1){  //代码列
								dm = rc;
								tr.id = dm;
							}else if(p == b + 1){
								zt = rc;
								tr.id = dm + "#" + zt;
							}					
							//td.innerHTML = "<a href=http://www.treeid/code_" + dm + " id='" + p + "' onclick='changeCss(this,\"" + dm + "\",\"gg\")'>" + rc + "</a>";
							td.innerHTML = "<a href=http://www.treeid/code_" + dm + " id='" + p + "' onclick='changeCss(this,\"gg\")'>" + rc + "</a>";

							if(p == n + 1){							
								td.getElementsByTagName("a")[0].style.color = "#FF6633";
							}
							if(p == b + 1){							
								td.getElementsByTagName("a")[0].style.color = "#FFA500";
							}																
							tr.appendChild(td);							
							p++;
						}														
						tbody.appendChild(tr);																
					}					
					var div = document.getElementById("towrite");									
					div.appendChild(table);
					table.id = "gg";	
								
				}	
				
				document.getElementById("PriceDate").value = tt;
				
				//var table=document.getElementsByTagName("table")[0];
				makeSortable(table);
				hover();
			}
			
			function makeSortable(table) {
				var headers=table.getElementsByTagName("th");
				var m1 = 0; //涨停时间
				var m2 = 0; //连板
				for(var i=0;i<headers.length;i++){				
					(function(n){
						var flag=false;
						
						if(headers[i].textContent == "涨停时间"){							
							m1 = i;
						}	
						if(headers[i].textContent == "状态"){							
							m2 = i;
						}							
						headers[n].onclick=function(){					
							showCol(n);		//高亮
							var tbody=table.tBodies[0];
							var rows=tbody.getElementsByTagName("tr");
							rows=Array.prototype.slice.call(rows,0);

							//基于第n个<td>元素的值对行排序
							rows.sort(function(row1,row2){
								headtxt = headers[n].textContent;								
								var cell1=row1.getElementsByTagName("td")[n];//获得第n个单元格
								var cell2=row2.getElementsByTagName("td")[n];																
								var val1=cell1.textContent||cell1.innerText;//获得文本内容
								var val2=cell2.textContent||cell2.innerText;
								if(headtxt.indexOf("涨停原因") != -1){									
									
									var sj1=row1.getElementsByTagName("td")[m1];//涨停时间
									var sj2=row2.getElementsByTagName("td")[m1];																
									var s1=sj1.textContent||sj1.innerText;
									var s2=sj2.textContent||sj2.innerText;
									
									var lb1=row1.getElementsByTagName("td")[m2];//连板
									var lb2=row2.getElementsByTagName("td")[m2];																
									var b1=lb1.textContent||lb1.innerText;
									var b2=lb2.textContent||lb2.innerText;
									b1 = b1.replace("首板","1板").replace("新上市未开板","0");
									b2 = b2.replace("首板","1板").replace("新上市未开板","0");
										
									val11 = val1.split("(")[0];
									val21 = val2.split("(")[0];
									val12 = parseInt(val1.split("(")[1].split(")")[0]);
									val22 = parseInt(val2.split("(")[1].split(")")[0]);
									
									if(val12 < val22){
										return -1;
									}else if(val12 > val22){
										return 1;
									}else if(val12 == val22 && val11 > val21){
										return 1;
									}else if(val12 == val22 && val11 < val21){
										return -1;
									}else if(val12 == val22 && val11 == val21 && b1 > b2){
										return 1;
									}else if(val12 == val22 && val11 == val21 && b1 < b2){
										return -1;	
									}else if(val12 == val22 && val11 == val21 && b1 == b2 && s1 > s2){
										return -1;
									}else if(val12 == val22 && val11 == val21 && b1 == b2 && s1 < s2){
										return 1;
									}else{
										return 0;
									}
								}else{
									if(headtxt.indexOf("名称") != -1 || headtxt.indexOf("板块") != -1 || headtxt.indexOf("时间") != -1 ){
										val1 = val1;
										val2 = val2;
									}else if(headtxt.indexOf("状态") != -1){
										val1 = val1.replace("首板","1板").replace("新上市未开板","0");
										val2 = val2.replace("首板","1板").replace("新上市未开板","0");
									}else if(headtxt.indexOf("涨停原因") != -1){
										val1 = parseInt(val1.split("(")[1].split(")")[0]);
										val2 = parseInt(val2.split("(")[1].split(")")[0]);
									}else{
										if(val1 == "-"){
											val1 = " ";
										}
										if(val2 == "-"){
											val2 = " ";
										}
										val1 = val1.replace(" ","0").replace("无","1000").replace("NaN","0");
										val2 = val2.replace(" ","0").replace("无","1000").replace("NaN","0");
										if(val1.indexOf("万") != -1){
											val1 = parseFloat(val1)*10000;
										}else if(val1.indexOf("亿") != -1){
											val1 = parseFloat(val1)*100000000;
										}else{
											val1 = parseFloat(val1);
										}
										
										if(val2.indexOf("万") != -1){
											val2 = parseFloat(val2)*10000;
										}else if(val2.indexOf("亿") != -1){
											val2 = parseFloat(val2)*100000000;
										}else{
											val2 = parseFloat(val2);
										}
									}
									if(val1<val2){
										return -1;
									}else if(val1>val2){
										return 1;
									}else{
										return 0;
									}
								}
							});
							if(flag){
								rows.reverse();
							}
							
							for(var i=0;i<rows.length;i++){
								tbody.appendChild(rows[i]);
							}

							flag=!flag;
						}
					}(i));
				}
			}
			
			function showCol(iCol){				
				var oTable = document.getElementsByTagName('table')[0];
				for (i=0;i < oTable.rows.length; i++){										
					for (j=0;j < oTable.rows[0].cells.length; j++){
						oTable.rows[i].cells[j].style.color = "#E5E5E5";
						oTable.rows[i].cells[bk].style.color = "#FFA500";
						<!-- if(fs == 1){ -->
							<!-- oTable.rows[i].cells[9].style.color = "#FFA500"; -->
						<!-- }else if(fs == 2){							 -->
							<!-- if(k == 0){ -->
								<!-- oTable.rows[i].cells[13].style.color = "#FFA500"; -->
							<!-- }else{ -->
								<!-- oTable.rows[i].cells[12].style.color = "#FFA500"; -->
							<!-- } -->
						<!-- }else if(fs == 4){							 -->
							<!-- if(k == 0){ -->
								<!-- oTable.rows[i].cells[13].style.color = "#FFA500"; -->
							<!-- }else{ -->
								<!-- oTable.rows[i].cells[10].style.color = "#FFA500"; -->
							<!-- } -->
						<!-- }	 -->
					}
					oTable.rows[i].cells[iCol].style.color = "#FF6633";					
				}

				otagsA = oTable.getElementsByTagName("a");  //a变色
				for (i = 0; i < otagsA.length; i++) {
					otagsA[i].style.color = "#E5E5E5";
					
					if(otagsA[i].id == bk + 1){
						otagsA[i].style.color = "#FFA500";								
					}
					<!-- if(fs == 1 && otagsA[i].id == 10){ -->
						<!-- otagsA[i].style.color = "#FFA500";								 -->
					<!-- }else if(fs == 2 && k ==0 && otagsA[i].id == 14){ -->
						<!-- otagsA[i].style.color = "#FFA500";								 -->
					<!-- }else if(fs == 2 && k ==1 && otagsA[i].id == 13){ -->
						<!-- otagsA[i].style.color = "#FFA500";								 -->
					<!-- }else if(fs == 4 && k ==0 && otagsA[i].id == 14){ -->
						<!-- otagsA[i].style.color = "#FFA500";								 -->
					<!-- }else if(fs == 4 && k ==1 && otagsA[i].id == 11){ -->
						<!-- otagsA[i].style.color = "#FFA500";								 -->
					<!-- } -->
					if(otagsA[i].id == iCol + 1){
						otagsA[i].style.color = "#FF6633";
					}
				}								
			}
		</script>		
	</body>
</html>